import { http } from "@/utils/http";
import { Result } from "../types";

export type data = {
    name?: string,
    status?: number,
    note?: string,
    agvids?: string,
    stationList?: any
};

type search = {
    name?: string,
    Name?: string,
    pageNumber: number,
    pageSize: number,
    sortName: string,
    sortType: number
}

// 任务区域列表
export const taskareaList = (params?: search) => {
    return http.request<Result>("get", "/api/taskarea/List", { params });
};

// 新增任务区域
export const taskareaAdd = (data: data) => {
    return http.request<Result>("post", "/api/taskarea/Add", { data });
};

// 删除任务区域
export const taskareaDel = (id?: number) => {
    return http.request<Result>("post", `/api/taskarea/Delete/${id}`, {});
};

// 任务区域详情
export const getTaskarea = (id?: number) => {
    return http.request<Result>("get", `/api/taskarea/Get/${id}`, {});
};

// 任务区域修改
export const taskareaUpdate = (data: data) => {
    return http.request<Result>("post", "/api/taskarea/Update", { data });
};

// 任务区域状态修改
export const updateStatus = (data: any) => {
    return http.request<Result>("post", `/api/taskarea/UpdateStatus?id=${data.id}`, { data: data.state });
};